<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------

namespace app\backend\validate;
use think\Db;
/**
 * 基础验证器
 */
class Admin extends AdminBase
{
	// 验证规则
    protected $rule = [
        'username'          => 'require|length:3,30',
        'password'          => 'require|length:3,60',
        'repassword'        => 'require|confirm:password',
        'captcha|验证码'     =>'require|captcha',
        'code'              =>'require',
    ];

    // 验证提示
    protected $message = [
        'username.require'    => '用户名不能为空',
        'username.length'     => '用户名长度为3-30个字符之间',
        'username.unique'     => '用户名已存在',
        'password.require'    => '密码不能为空',
        'password.length'     => '密码长度为3-60个字符之间',
        'repassword.require'        => '请再次输入密码',
        'repassword.confirm'        => '两次输入的密码不一致',
        'captcha.require'      => '验证码不能为空',   

    ];

    // 应用场景
    protected $scene = [
        'add'       =>  ['username','password','repassword'],
        'select'  =>  ['username','password','captcha'],
        'no_captcha' =>['username','password'],
        'edit'      =>  ['password','repassword'],
    ];
}
